<?php
session_start();
include_once( '../config.php' );
include_once( '../weibooauth.php' );

$oAuth = new WeiboOAuth( WB_AKEY , WB_SKEY  );

$keys = $oAuth->getRequestToken();

if( strpos( $_SERVER['SCRIPT_URI'] , 'index.php' ) === false )
	$callback =  $_SERVER['SCRIPT_URI'].'savekey.php';
else	
	$callback =  str_replace( 'index.php' , 'savekey.php' , $_SERVER['SCRIPT_URI'] );


$aurl = $oAuth->getAuthorizeURL( $keys['oauth_token'] ,true , $callback );

$_SESSION['keys'] = $keys;

?>
<a href="<?=$aurl?>">登录</a>